<?xml version="1.0" encoding="UTF-8" ?>
<%@page import="java.sql.Driver"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.DriverManager" %>
<%@page import="java.sql.Connection" %>
<%@page import="java.sql.Statement" %>
<%@page import="java.sql.ResultSet" %>
<jsp:directive.page import="java.sql.Date" />
<jsp:directive.page import="java.sql.Timestamp" />
<jsp:directive.page import="java.sql.SQLException" />

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>显示人员</title>
</head>
<body>
<%
	Connection conn = null;
	Statement stmt = null;
	ResultSet rs = null;
	try{
		DriverManager.registerDriver(new com.mysql.jdbc.Driver());
		//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
		conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/sakila","root","kvkens");
		//conn = DriverManager.getConnection("jdbc:oracle:thin:@211.101.37.230:1521:fantlam","jxhw","jxhw");
		stmt = conn.createStatement();
		//rs = stmt.executeQuery("select * from htgl_mjlx order by id");
		String sql = "select * from film order by film_id limit " +request.getParameter("start") +","+request.getParameter("end");
		rs = stmt.executeQuery(sql);
%>
	<table border="1" cellpadding="1" cellspacing="3">
		<tr style="background-color: pink">
			<th>编号</th><th>标题</th><th>描述</th>
		</tr>
		<%
			while(rs.next()){
				int film_id = rs.getInt("film_id");
				String title = rs.getString("title");
				String description = rs.getString("description");
				out.print("<tr>");
				out.print("<td>" + film_id + "</td><td>" + title + "</td><td>" + description + "</td>");
				out.print("</tr>");
			}
		%>
	</table>		
<%
		
	}catch(SQLException e){
		out.println("错误："+ e.getMessage());
		e.printStackTrace();
	}finally{
		if(rs != null)rs.close();
		if(stmt != null)stmt.close();
		if(conn != null)conn.close();
	}
%>
</body>
</html>